Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid filesystem limits using a trie #26

Merged
merged 3 commits into from
Oct 12, 2015
Merged

Avoid filesystem limits using a trie #26

merged 3 commits into from
Oct 12, 2015

Conversation

smellsblue
Copy link
Contributor

Implement storage trie based on idea from @pcarranza in discussion for #18.

All tests are passing with no additional changes... should I write a test that fails if the storage isn't using a trie though?

@pcarranza
Copy link
Contributor

Let me get the weird cases we will find down the line to add tests for those and see what happens there.

@smellsblue
Copy link
Contributor Author

I can already think of a case that will fail... - seems fine on my machine, but I bet . would do bad things.

However, a simple regex gsub I think would fix it... maybe gsub anything not in a set of acceptable characters? Like:

trie_parents = @name[0...3].gsub(/[^0-9a-zA-Z]/, "_").split("")

@smellsblue
Copy link
Contributor Author

hmmm, now that I think of it, the . probably wouldn't really pose a problem... it would essentially get ignored in the File.join, but it wouldn't be added in a trie manner, so I think gsubbing everything outside a certain range might still be the best option

@pcarranza
Copy link
Contributor

This is the whole data sample of what we can find with current specs:

["_", "-", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "."]

@pcarranza
Copy link
Contributor

So, yeah, maybe replace the . with something else that is not so full of meaning at the filesystem level.

And downcase to prevent the OSX HFS stupidity

Downcase trie to avoid case insensitive file system issues
@pcarranza
Copy link
Contributor

👍

smellsblue added a commit that referenced this pull request Oct 12, 2015
Avoid filesystem limits using a trie
@smellsblue smellsblue merged commit 96a23e2 into master Oct 12, 2015
@smellsblue smellsblue deleted the storage-trie branch October 12, 2015 21:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants